<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>美丽说注册</title>
    <style>
        .main {
            width: 100%;
            margin: 0 auto;
        }

        .main_img {
            margin-left: 360px;
        }

        .content {
            width: 564px;
            height: 564px;
            margin: 0 auto;
        }

        .register_left {
            width: 590px;
            padding-left: 55px;
            height: 574px;
            float: left;
        }

        form {
            width: 578px;
        }

        fieldset {
            border: none;
            padding: 0;
            margin-top: 16px;
            overflow: hidden;
            line-height: 30px;
            clear: both;
        }


        fieldset .tit {
            width: 83px;
            float: left;
            text-align: right;
            color: #333;
            font-size: 14px;
            display: block;
        }

        fieldset .text {
            border: 1px solid #CFCFCF;
            float: left;
            width: 254px;
            height: 30px;
            margin-left: 5px;
            line-height: 30px;
            background: none;
            border-radius: 3px;
        }

        fieldset .spanspan {
            font-size: 12px;
            color: #999;
            width: 198px;
            float: left;
            height: 30px;
            line-height: 30px;
            margin: 0;
        }

        fieldset .button {
            width: 131px;
            height: 35px;
            margin-left: 90px;
            background: yellowgreen;
            border: none;
            color: white;
        }
    </style>
    <script src="./js/jquery-1.11.0.js"></script>
</head>

<body>
    <div class="main">
        <div class="main_img">
            <a href="./index.html">
                <img src="http://www.nrgou.com/App/Tpl/Home/nrgou/Public/img/logo.png" alt="">
            </a>
        </div>

        <div class="content">
            <div class="register_left">
                <h1>新用户注册</h1>
                <form action="" method="post">

                    <fieldset class="ipt_name">
                        <label class="tit" for="">用户名:</label>
                        <input id="username" type="username" class="text" placeholder="用户名">
                        <span class="spanspan"></span>
                    </fieldset>

                    <fieldset class="ipt_password">
                        <label class="tit" for="">密码:</label>
                        <input id="password" type="password" class="text" placeholder="密码">
                        <span class="spanspan"></span>
                    </fieldset>

                    <fieldset class="ipt_pwd">
                        <label class="tit" for="">确认密码:</label>
                        <input id="pwd" type="password" class="text" placeholder="确认密码">
                        <span class="spanspan"></span>
                    </fieldset>

                    <!-- <fieldset class="ipt_mail">
                    <label class="tit" for="">电子邮箱:</label>
                    <input type="email" class="text" placeholder="电子邮箱">
                    <span class="spanspan"></span>
                </fieldset> -->

                    <fieldset class="ipt_check">
                        <label class="tit" for="">验证码:</label>
                        <input id="vercode" type="text" class="text" placeholder="验证码"><a id="sc"></a><br>
                        <span class="spanspan"></span>
                    </fieldset>

                    <fieldset class="ipt_btn">
                        <input id="resBtn" type="button" class="button" value="注册">
                    </fieldset>
                </form>

            </div>
        </div>

    </div>


    <script>
        $("#resBtn").click(function () {
            $.get("http://jx.xuzhixiang.top/ap/api/reg.php", {
                username: $("input").eq(0).val(),
                password: $("input").eq(1).val()
            }).then(data => {
                // console.log(data);
                if(data == 0){
                    alert("用户名已存在");
                } else {
                    location.href = "login.html";
                }
            })
        })
    </script>


</body>

</html>